home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 155 (1991-03-10)(Manewaldt, A.)(DE)(PD).zip / Taifun 155 (1991-03-10)(Manewaldt, A.)(DE)(PD).adf / IFF-Lader / IFFInfo.asm < prev    next >
Assembly Source File  |  1991-03-01  |  7KB  |  328 lines

  1. * IFFInfo V1.0
  2. * E.Hambuch
  3. * Darf nicht veraendert werden
  4.   include 'exec.i'
  5.   include 'dos.i'
  6.   include 'startup.i'
  7. _main:
  8.   tst.l _WBenchMsg  ;from Workbench
  9.   bne.s startall    ;Ja
  10.   clr.b -1(a0,d0.w)  ;Parameter von CLI
  11.   move.l a0,ParaPtr
  12. startall:              ;Libs oeffnen
  13.   lea dosname,a1
  14.   CALLEXEC OldOpenLibrary
  15.   move.l d0,_DOSBase
  16.   beq ende
  17.   tst.l _WBenchMsg
  18.   beq nowb
  19.   move.l _WBenchMsg,a0
  20.   cmp.b #2,31(a0)  ;NumArgs
  21.   bne closedos     ;kein 2.Icon angeklickt
  22.   move.l $24(a0),a0
  23.   move.l 8(a0),d1      ;Dir von Iff-Datei
  24.   move.l 12(a0),ParaPtr ;Name von Iff-Datei
  25.   ; 0(a0) Dir von IffInfo
  26.   ; 4(a0) Name von IffInfo
  27.   move.l _DOSBase,a6
  28.   jsr _LVOCurrentDir(a6)  ;Verzeichnis setzen
  29.   move.l #cliwindow,d1
  30.   move.l #MODE_OLDFILE,d2
  31.   jsr _LVOOpen(a6)        ;Fenster oeffnen
  32.   move.l d0,Out
  33.   bra.s wb2
  34. nowb
  35.   CALLDOS Output
  36.   move.l d0,Out
  37. wb2:
  38.   beq closedos  ;Kein Output ?
  39.   lea text1,a0
  40.   bsr print
  41.   move.l ParaPtr,d1           ;Datei oeffnen
  42.   move.l #MODE_OLDFILE,d2
  43.   jsr _LVOOpen(a6)
  44.   move.l d0,File
  45.   bne.s w1
  46.   lea text2,a0                ;Fehler
  47.   bsr print
  48.   bra closewin
  49. w1:
  50.   move.l File,d1
  51.   move.l #buffer,d2
  52.   moveq.l #12,d3
  53.   jsr _LVORead(a6)          ;12 Bytes lesen
  54.   cmp.l #'FORM',buffer      ;Iff ?
  55.   beq.s w2
  56.   lea text3,a0              ;Nein
  57.   bsr print
  58.   bra closefile
  59. w2:
  60.   lea buffer,a0
  61.   lea IffType,a1
  62.   addq.l #8,a0
  63.   bsr copyname              ;Type ausgeben 
  64.   move.l File,d1
  65.   move.l #buffer,d2
  66.   moveq.l #28,d3
  67.   jsr _LVORead(a6)
  68.   lea buffer,a0
  69.   cmp.l #'BMHD',(a0)        ;BMHD muss !! direkt nach FORM/ILBm kommen
  70.   beq.s w3
  71.   lea text3,a0              ;Wenn nicht -> Fehler
  72.   bsr print
  73.   bra closefile
  74. w3:
  75.   lea buffer,a4             ;Werte von BMHD ausgeben
  76.   addq.l #8,a4
  77.   move.w (a4),d3            ;Wert in d3
  78.   lea pWidth,a0             ;Buffer in a0
  79.   bsr _dez                  ; umwandeln
  80.   move.w 2(a4),d3
  81.   lea pHeight,a0
  82.   bsr _dez
  83.   move.w 4(a4),d3
  84.   lea xpos,a0
  85.   bsr _dez
  86.   move.w 6(a4),d3
  87.   lea ypos,a0
  88.   bsr _dez
  89.   move.b 8(a4),d0
  90.   lea depth,a0
  91.   bsr dez22
  92.   move.b 8(a4),d1
  93.   moveq #0,d0
  94.   bset d1,d0
  95.   lea maxcols,a0
  96.   bsr dez22
  97.   move.b 9(a4),d0
  98.   lea mask,a0
  99.   bsr dez22
  100.   move.b 10(a4),d0
  101.   lea comp,a0
  102.   bsr dez22
  103.   move.w 12(a4),d3
  104.   lea transc,a0
  105.   bsr _dez
  106.   move.b 14(a4),d0
  107.   lea xas,a0
  108.   bsr dez22
  109.   move.b 15(a4),d0
  110.   lea yas,a0
  111.   bsr dez22
  112.   move.w 16(a4),d3
  113.   lea scrWidth,a0
  114.   bsr _dez
  115.   move.w 18(a4),d3
  116.   lea scrHeight,a0
  117.   bsr _dez
  118.   lea text4,a0
  119.   bsr print
  120.   lea chunktxt,a0          ;ausgeben
  121.   bsr print
  122. chunkloop:                 ;uebrige chunks bearbeiten
  123.   move.l File,d1
  124.   move.l #buffer,d2
  125.   moveq #8,d3
  126.   jsr _LVORead(a6)
  127.   tst.l d0
  128.   bls closefile          ;Fileende -> Ende
  129.   lea buffer,a0
  130.   move.l 4(a0),ChunkLen
  131.   move.b #'/',4(a0)
  132.   clr.b 5(a0)
  133.   bsr print               ;ausgeben
  134.   cmp.l #'CAMG',buffer       ;ViewPort-Modus (CAMG) ?
  135.   bne cweiter
  136.   move.l File,d1
  137.   move.l #buffer,d2
  138.   move.l ChunkLen,d3
  139.   jsr _LVORead(a6)
  140.   move.l buffer,ViewMode
  141.   bra chunkloop
  142. cweiter:
  143.   cmp.l #'BODY',buffer         ;BODY ? -> Ende
  144.   beq.s endchunk
  145.   move.l ChunkLen,-(sp)
  146. readloop:                     ;Rest lesen
  147.   move.l File,d1
  148.   move.l #buffer,d2
  149.   moveq #1,d3
  150.   jsr _LVORead(a6)
  151.   tst.l d0
  152.   bls.s endchunk
  153.   subq.l #1,ChunkLen
  154.   bne readloop
  155. off:  move.l (sp)+,d0
  156.   btst #0,d0                ;ungerade ?
  157.   beq chunkloop             ;nein
  158.   move.l File,d1
  159.   move.l #buffer,d2
  160.   moveq #1,d3
  161.   jsr _LVORead(a6)
  162.   bra chunkloop
  163. endchunk:
  164.   lea backspc,a0
  165.   bsr print
  166.   lea text5,a0
  167.   bsr print
  168.   move.l ViewMode,d5
  169.   beq islores
  170.   lea ViewTable,a4   ;ViewMode ausgeben
  171. seekview:
  172.   move.l (a4)+,a2
  173.   move.w (a4)+,d1
  174.   bmi.s endview
  175.   btst d1,d5
  176.   beq.s seekview
  177.   move.l a2,a0
  178.   bsr print
  179.   bra.s seekview
  180. endview:
  181.   lea backspc,a0
  182.   bsr.s print
  183.   lea lf,a0
  184.   bsr print
  185.   bra.s closefile
  186. islores:
  187.   lea view_lores,a0
  188.   bsr print
  189. closefile:
  190.   move.l File,d1
  191.   CALLDOS Close
  192. closewin:
  193.   tst.l _WBenchMsg   ;bei wbstart fenster schliessen
  194.   beq.s closedos
  195.   move.l Out,d1     ;Warte auf <return>
  196.   move.l #buffer,d2
  197.   moveq #2,d3
  198.   jsr _LVORead(A6)
  199.   move.l Out,d1
  200.   jsr _LVOClose(A6)
  201. closedos:
  202.   move.l _DOSBase,a1
  203.   CALLEXEC CloseLibrary
  204. ende: rts
  205. print:                ;Text ausgeben muss mit $00 beendet sein !
  206.   move.l a0,a1
  207. l00: tst.b (a1)+
  208.   bne.s l00
  209.   suba.l a0,a1
  210.   move.l Out,d1
  211.   move.l a0,d2
  212.   move.l a1,d3
  213.   subq.l #1,d3
  214.   jmp _LVOWrite(a6)
  215. copyname:
  216.   move.b (a0)+,(a1)+
  217.   move.b (a0)+,(a1)+
  218.   move.b (a0)+,(a1)+
  219.   move.b (a0)+,(a1)+
  220.   rts
  221. _dez:             ;Word in d3 -> (a0)
  222.   lea _deztab,a1
  223.   moveq #0,d1
  224. _dez2: moveq #'0'-1,d2
  225.   move.l d1,d4
  226.   lsl.l #2,d4
  227. _dez3: addq.b #1,d2
  228.   move.l d3,d5
  229.   sub.l 0(a1,d4.w),d3
  230.   bcc _dez3
  231.   move.l d5,d3
  232.   move.b d2,0(a0,d1.w)
  233.   addq.b #1,d1
  234.   cmp.b #5,d1
  235.   bne _dez2
  236.   rts
  237. _deztab:
  238.   dc.l 10000
  239.   dc.l 1000
  240.   dc.l 100
  241.   dc.l 10
  242.   dc.l 1
  243. dez22:          ;Byte in d0 -> (a0)
  244.   moveq #0,d1
  245.   move.b d0,d1
  246.   divu #10,d1
  247.   add.b #'0',d1
  248.   move.b d1,(a0)+
  249.   swap d1
  250.   add.b #'0',d1
  251.   move.b d1,(a0)
  252.   rts
  253. cliwindow: dc.b 'CON:0/0/640/200/'
  254.   dc.b 'IFFInfo V1.0 by E.Hambuch'
  255.   dc.b 0
  256. dosname: DOSNAME
  257. _DOSBase: dc.l 0
  258. File:     dc.l 0
  259. Out:      dc.l 0
  260. ParaPtr:  dc.l 0
  261. ChunkLen: dc.l 0
  262. ViewMode:  dc.l 0
  263. ViewTable:
  264.   dc.l view_lace
  265.   dc.w 2
  266.   dc.l view_ehb
  267.   dc.w 7
  268.   dc.l view_ham
  269.   dc.w 11
  270.   dc.l view_sprites
  271.   dc.w 14
  272.   dc.l view_hires
  273.   dc.w 15
  274.   dc.l 0
  275.   dc.w -1
  276. view_lace: dc.b 'LACE|',0
  277. view_ehb: dc.b 'EXTRAHALFBRITE|',0
  278. view_ham: dc.b 'HAM|',0
  279. view_sprites: dc.b 'SPRITES|',0
  280. view_hires: dc.b 'HIRES|',0
  281. view_lores: dc.b 'LORES',10,0
  282. text1:
  283.   dc.b 'IFFInfo V1.0 by E.Hambuch',10
  284.   dc.b '-------------------------',10,0
  285. text2:
  286.   dc.b 'Cant open file !',10
  287.   dc.b ' USAGE: IFFInfo <File>',10,0
  288. text3:
  289.   dc.b 'Error in IFF',10,0
  290. text4:
  291.   dc.b 'Iff-Type: '
  292. IffType: dc.b '----',10
  293.   dc.b 'BMHD-Chunk:',10
  294.   dc.b 'picWidth:    '
  295. pWidth: dc.b '00000',10
  296.   dc.b 'picHeight:   '
  297. pHeight: dc.b '00000',10
  298.   dc.b 'X-Position:  '
  299. xpos:    dc.b '00000',10
  300.   dc.b 'Y-Position:  '
  301. ypos:    dc.b '00000',10
  302.   dc.b 'Depth:       '
  303. depth:   dc.b '00',10
  304.   dc.b 'Max.Colors:  '
  305. maxcols: dc.b '00',10
  306.   dc.b 'Masking:     '
  307. mask:    dc.b '00',10
  308.   dc.b 'Compression: '
  309. comp:    dc.b '00',10
  310.   dc.b 'TransColor:  '
  311. transc:  dc.b '00000',10
  312.   dc.b 'xAspect:     '
  313. xas: dc.b '00',10
  314.   dc.b 'yAspect:     '
  315. yas:  dc.b '00',10
  316.   dc.b 'scrWidth:    '
  317. scrWidth: dc.b '00000',10
  318.   dc.b 'scrHeight:   '
  319. scrHeight: dc.b '00000',10
  320.   dc.b 0
  321. chunktxt: dc.b 'Chunk(s): ',0
  322. text5: dc.b 10,'ViewMode: '
  323. backspc: dc.b 27,8,32,0,10,0
  324. lf: dc.b 10,0
  325.   EVEN
  326. buffer: ds.b 30
  327.   end
  328.